<template>
  <div class="data-view">
    <div class="data-view-content">
      <div class="data-view-header">
        <i :class="'iconfont ' + icon[modeParams.menu]"></i>
        {{ title[modeParams.menu] }}
      </div>

      <div class="data-view-body">
        <transition name="fade-transform">
          <person v-if="modeParams.menu === '1'" />
          <bvideo v-else-if="modeParams.menu === '2'" />
          <sensor v-else-if="modeParams.menu === '3'" />
          <alarm v-else-if="modeParams.menu === '4'" />
          <road v-else-if="modeParams.menu === '0'" />
        </transition>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import person from './person/index.vue'
import bvideo from './bvideo/bvideo.vue'
import sensor from './sensor/sensor.vue'
import alarm from './alarm/alarm.vue'
import road from './road/road.vue'
import { storeToRefs } from 'pinia'
import { useAuthStore } from '@/store/auth'

const title = [
  '区域信息',
  '人员信息',
  '视频监控',
  '传感器信息',
  '报警信息',
]

const icon = [
  'icon-xiangdao',
  'icon-renyuandingwei',
  'icon-shexiangtou',
  'icon-shebeichuanganqi',
  'icon-baojingxinxi',
]

const authStore = useAuthStore()
const { modeParams } = storeToRefs(authStore)
</script>
<style lang="scss" scoped>
.data-view {
  .data-view-content{
    position: relative;
    padding: 8px 16px 0 0;
    
    height: 100%;
    display: flex;
    flex-direction: column;
    &::before{
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 1px;
      height: 100%;
      background-color: var(--el-border-color);
    }
    .data-view-header {
      margin-bottom: 24px;
      padding-left: 16px;
      font-size: 16px;
      font-weight: 900;
      color: var(--el-color-primary);
      text-transform: uppercase;
      letter-spacing: 4px;
      display: flex;
      align-items: center;
      .iconfont {
        font-size: 18px;
        margin-right: 12px;
      }
    }
    .data-view-body {
      flex: 1;
      overflow: hidden;
    }
  }
}
</style>
